#ifndef DRV_NET_PORT_H
#define DRV_NET_PORT_H
#include "bsp_gpio.h"
#include "bsp_uart.h"


#define BC26_TR_PIN     GPIO_Pin_6
#define BC26_PWR_PIN    GPIO_Pin_5
#define BC26_RST_PIN    GPIO_Pin_9
#define BC26_RUN_PIN    GPIO_Pin_8
#define BC26_INT_PIN    GPIO_Pin_7



#define NET_TR_PIN      BC26_TR_PIN
#define NET_PWR_PIN     BC26_PWR_PIN
#define NET_RST_PIN     BC26_RST_PIN
#define NET_RUN_PIN     BC26_RUN_PIN
#define NET_INT_PIN     BC26_INT_PIN

#define NET_TR_ENABLE()       GPIO_WriteBit(GPIOC, NET_TR_PIN, Bit_SET)
#define NET_TR_DISABLE()      GPIO_WriteBit(GPIOC, NET_TR_PIN, Bit_RESET)

#define NET_PWR_ENABLE()      GPIO_WriteBit(GPIOC, NET_PWR_PIN, Bit_SET)
#define NET_PWR_DISABLE()     GPIO_WriteBit(GPIOC, NET_PWR_PIN, Bit_RESET)

#define NET_RST_ENABLE()      GPIO_WriteBit(GPIOC, NET_RST_PIN, Bit_SET)
#define NET_RST_DISABLE()     GPIO_WriteBit(GPIOC, NET_RST_PIN, Bit_RESET)

#define NET_RUN_ENABLE()      GPIO_WriteBit(GPIOC, NET_RUN_PIN, Bit_SET)
#define NET_RUN_DISABLE()     GPIO_WriteBit(GPIOC, NET_RUN_PIN, Bit_RESET)

#define NET_INT_ENABLE()      GPIO_WriteBit(GPIOC, NET_INT_PIN, Bit_SET)
#define NET_INT_DISABLE()     GPIO_WriteBit(GPIOC, NET_INT_PIN, Bit_RESET)


extern int32_t drv_net_port_ctrl_init(void);
extern int32_t drv_net_port_uart_init(void);
extern int32_t drv_net_port_uart_uninit(void);
extern int32_t drv_net_port_uart_write_bytes(const uint8_t *pdata, uint32_t len);
extern int32_t drv_net_port_uart_read_byte(uint8_t *pdata);
extern int32_t drv_net_port_uart_rx_start(void);

extern int32_t drv_net_port_install(void);
extern int32_t drv_net_port_uninstall(void);

extern int32_t drv_net_port_uart_baudrate_change(uint32_t baudrate);
#endif
